package day11.Exer;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Classhour {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        try {
            System.out.println("请输入总课时：");
            int hour = in.nextInt();
            if (hour < 100) {
                throw new Exception("课时太少了");
            }
            System.out.println("请输入课程数");
            int num = in.nextInt();
            double avg = hour / num;
            System.out.println("平均课时为：" + avg);
        } catch (InputMismatchException e) {
            System.out.println("只能输入数字");
        } catch (ArithmeticException e) {
            System.err.println("除数不能为0");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

}
